package Demo4;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86136
 * Date: 2024-05-26
 * Time: 16:19
 */
public class Fish extends Animal implements ISwimming{
    public Fish(String name, int age) {
        super(name, age);
    }

    @Override
    public void eat() {
        System.out.println(name + "吃鱼饲料");
    }

    @Override
    public void swimming() {
        System.out.println(name + "在游泳");
    }

    @Override
    public boolean equals(Object obj) {
        Fish fish = (Fish) obj;
        return this.name.equals(fish.name)
                && this.age == fish.age;
    }
    public int hashCode() {
        return Objects.hash(name,age);
    }
}
